#include "Image.h"

Image::Image()
{
	canvas = NULL;
	d_id = -1;
}
Image::Image(string _src, int _x, int _y, DrawingCanvas *_canvas)
{
	canvas = _canvas;
	d_id = canvas->addDrawing(Drawing(_src,_x,_y,d_image));
}
Image::Image(string _src, int _x, int _y, int _w, int _h, DrawingCanvas *_canvas)
{
	canvas = _canvas;
	d_id = canvas->addDrawing(Drawing(_src,_x,_y,_w,_h,d_image));
}
Image::Image(string _src, int _x, int _y, OSL_PIXELFORMAT _PF, DrawingCanvas *_canvas)
{
	canvas = _canvas;
	d_id = canvas->addDrawing(Drawing(_src,_x,_y,_PF,d_image));
}
Image::Image(string _src, int _x, int _y, int _w, int _h, OSL_PIXELFORMAT _PF, DrawingCanvas *_canvas)
{
	canvas = _canvas;
	d_id = canvas->addDrawing(Drawing(_src,_x,_y,_w,_h,_PF,d_image));
}

bool Image::imageIsLoaded()
{
	return canvas->getDrawing(d_id).imageIsLoaded();
}
bool Image::setSrc(string _src)
{
	canvas->getDrawing(d_id).setSrc(_src);
	return imageIsLoaded();
}
void Image::setImage(OSL_IMAGE *img)
{
	canvas->getDrawing(d_id).setImage(img);
}
void Image::setWidth(int _w)
{
	canvas->getDrawing(d_id).setWidth(_w);
}
void Image::setHeight(int _h)
{
	canvas->getDrawing(d_id).setHeight(_h);
}
void Image::setSize(int _w, int _h)
{
	canvas->getDrawing(d_id).setSize(Size(_w,_h));
}
void Image::setSize(Size s)
{
	canvas->getDrawing(d_id).setSize(s);
}
OSL_IMAGE * Image::getImage()
{
	return canvas->getDrawing(d_id).getImage();
}
int Image::getWidth()
{
	return canvas->getDrawing(d_id).getWidth();
}
int Image::getHeight()
{
	return canvas->getDrawing(d_id).getHeight();
}
Size Image::getSize()
{
	return canvas->getDrawing(d_id).getSize();
}
